<div id="permissions">

	<div class="single-head">
		<h3 class="pull-left"><i class="fa fa-desktop purple"></i> <?php echo Rights::t('core', 'Permissions'); ?></h3>
		<div class="breads pull-right">
			<strong>Nav</strong> : <a href="<?php echo Yii::app()->createUrl('User'); ?>">Home</a>  / Rigths / Permissions
		</div>
		<div class="clearfix"></div>
	</div>
	
	<?php 
		$this->beginWidget('zii.widgets.CPortlet', array(
			'htmlOptions'=>array(
				'class'=>''
			)
		));
		$this->widget('bootstrap.widgets.TbMenu', array(
			'type'=>'pills',
			'items'=>array(
				array('label'=>'Assignments', 'url'=>Yii::app()->controller->createUrl('assignment/view'), 'linkOptions'=>array()),
				array('label'=>'Permissions', 'url'=>Yii::app()->controller->createUrl('authItem/permissions'),'active'=>true, 'linkOptions'=>array()),
				array('label'=>'Roles', 'url'=>Yii::app()->controller->createUrl('authItem/roles'), 'linkOptions'=>array()),
				array('label'=>'Tasks', 'url'=>Yii::app()->controller->createUrl('authItem/tasks'), 'linkOptions'=>array()),
				array('label'=>'Operations', 'url'=>Yii::app()->controller->createUrl('authItem/operations'), 'linkOptions'=>array()),
			),
		));
		$this->endWidget();
	?>
	<p>
		<?php echo Rights::t('core', 'Here you can view and manage the permissions assigned to each role.'); ?><br />
		<?php echo Rights::t('core', 'Authorization items can be managed under {roleLink}, {taskLink} and {operationLink}.', array(
			'{roleLink}'=>CHtml::link(Rights::t('core', 'Roles'), array('authItem/roles')),
			'{taskLink}'=>CHtml::link(Rights::t('core', 'Tasks'), array('authItem/tasks')),
			'{operationLink}'=>CHtml::link(Rights::t('core', 'Operations'), array('authItem/operations')),
		)); ?>
	</p>

	<p><?php echo CHtml::link(Rights::t('core', 'Generate items for controller actions'), array('authItem/generate'), array(
	   	'class'=>'generator-link',
	)); ?></p>

	<?php $this->widget('bootstrap.widgets.TbGridView', array(
		'dataProvider'=>$dataProvider,
		'template'=>'{items}',
		'type'=>'striped bordered condensed',
		'emptyText'=>Rights::t('core', 'No authorization items found.'),
		'htmlOptions'=>array('class'=>'grid-view permission-table'),
		'columns'=>$columns,
	)); ?>

	<p class="info">*) <?php echo Rights::t('core', 'Hover to see from where the permission is inherited.'); ?></p>

	<script type="text/javascript">

		/**
		* Attach the tooltip to the inherited items.
		*/
		jQuery('.inherited-item').rightsTooltip({
			title:'<?php echo Rights::t('core', 'Source'); ?>: '
		});

		/**
		* Hover functionality for rights' tables.
		*/
		$('#rights tbody tr').hover(function() {
			$(this).addClass('hover'); // On mouse over
		}, function() {
			$(this).removeClass('hover'); // On mouse out
		});

	</script>

</div>
